﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace IWMAG.Core.Objects {
    public class Graphic {
        internal Texture2D Sheet;
        protected int XAxis = 0;
        protected int YAxis = 0;
        internal int Width = 0;
        internal int Height = 0;

        public Graphic(Texture2D sheet, int x, int y) {
            Sheet = sheet;
            XAxis = x;
            YAxis = y;

            Width = Sheet.Width / x;
            Height = Sheet.Height / y;
        }

        public Rectangle GetFrame(int i) {
            int x = i % XAxis;
            int y = i / YAxis;

            return new Rectangle(x * Width, y * Height, Width, Height);
        }
    }
}
